import { reqAddressInfo, reqTradeInfo } from '@/api'

const actions = {
    // 获取用户地址信息
    async getAddressInfo({ commit }) {
        const result = await reqAddressInfo();
        if (result.code == 200) {
            commit('GETADDRESSTNFO', result.data)
        }
    },
    // 获取商品清单数据
    async getTradeInfo({ commit }) {
        const result = await reqTradeInfo();
        if (result.code == 200) {
            commit('GETTRADETNFO', result.data)
        }
    },
}
const mutations = {
    GETADDRESSTNFO(state, addressList) {
        state.addressList = addressList
    },
    GETTRADETNFO(state, orderInfo) {
        state.orderInfo = orderInfo;
    },
}
const state = {
    addressList: [],
    orderInfo: {}
}
const getters = {}

export default {
    actions,
    mutations,
    state,
    getters,
}